package com.yima.baseproj.module.app.user;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yima.baseproj.module.app.user.model.AppUserUpdateInfoModel;
import com.yima.baseproj.module.config.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

@Data
@TableName("app_user")
public class AppUserEntity extends BaseEntity {

  @ApiModelProperty(value = "用户编号")
  @TableField(value = "user_no")
  private String userNo;

  @ApiModelProperty(value = "昵称")
  @TableField(value = "nick_name")
  private String nickName;

  @ApiModelProperty(value = "头像")
  @TableField(value = "head_img")
  private String headImg;

  @ApiModelProperty(value = "手机号")
  private String phone;

  @ApiModelProperty(value = "性别")
  @TableField(value = "sex")
  private String sex;

  @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd",locale = "zh")
  @ApiModelProperty(value = "生日")
  private Date birthday;

  @ApiModelProperty(value = "微信小程序openId")
  @TableField(value = "mp_weixin_open_id")
  private String mpWeixinOpenId;

  @ApiModelProperty(value = "微信开放平台unionid")
  @TableField(value = "weixin_unionid")
  private String weixinUnionid;

  public void setUpdateInfo(AppUserUpdateInfoModel params){
    BeanUtil.copyProperties(params,this, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
  }

}